﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="OAclient.Common" %>
<div id="mytable_list" style="border: 1px solid #C1DAD7;">
    <table id="my_table" class="table_style" width="100%" cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <th>
                    时间
                </th>
                <th>
                    外出地点
                </th>
                <th>
                    外出事由
                </th>
                <th>
                    联系人
                </th>
                <th>
                    电话
                </th>
                <th>
                    出门时间
                </th>
                <th>
                    预计返回时间
                </th>
                <th>
                    实际返回时间
                </th>
                <th>
                    备注
                </th>
                <th>
                    删除当日记录
                </th>
            </tr>
        </thead>
        <tbody>
            <%
                System.Data.DataTable allInfo = ViewData["allInfo"] as System.Data.DataTable;
                if (allInfo == null || allInfo.Rows.Count == 0)
                {%>
            <tr>
                <td colspan="0" style="text-align: center;">
                    当前无数据！
                </td>
            </tr>
            <% }
                else
                {
                    for (int i = 0; i < allInfo.Rows.Count; i++)
                    {
            %>
            <tr>
                <td style="display: none;">
                    <%=allInfo.Rows[i]["登记号"]%>
                </td>
                <td>
                    <%=allInfo.Rows[i]["登记日期"]%>
                </td>
                <td>
                    <%=allInfo.Rows[i]["外出地点"]%>
                </td>
                <td>
                    <%=allInfo.Rows[i]["外出事由"]%>
                </td>
                <td>
                    <%=allInfo.Rows[i]["联系人"]%>
                </td>
                <td>
                    <%=allInfo.Rows[i]["电话"] %>
                </td>
                <td>
                    <%=allInfo.Rows[i]["出门时间"]%>
                </td>
                <td>
                    <%=allInfo.Rows[i]["预计返回时间"]%>
                </td>
                <td style="padding: 0px; text-align: center;">
                    <%if (allInfo.Rows[i]["实际返回时间"].ToString() == "")
                      {%>
                    <input id="wcdj_comeback" name="wcdj_comeback" type="hidden" value="<%=DateTime.Now.ToString("yyyy-MM-dd HH:mm") %>" />
                    <input id="sure<%=allInfo.Rows[i]["登记号"]%>" name="<%=allInfo.Rows[i]["登记号"] %>" type="button"
                        value="确认返回" onclick="sureComeback(this.getAttribute('id'),this.getAttribute('name'));" />
                    <label id="lab<%=allInfo.Rows[i]["登记号"]%>">
                    </label>
                    <%  } %>
                    <%else
                        {%>
                    <%=allInfo.Rows[i]["实际返回时间"]%>
                    <%} %>
                </td>
                <td title='<%=allInfo.Rows[i]["备注"].ToString() %>'>
                    <%=allInfo.Rows[i]["备注"].ToString().Length > 25 ? allInfo.Rows[i]["备注"].ToString().Remove(25) : allInfo.Rows[i]["备注"].ToString()%>
                </td>
                <td>
                    <%string a = ViewData["date"] as string; %>
                    <%string b = allInfo.Rows[i]["登记日期"].ToString(); %>
                    <%if (allInfo.Rows[i]["登记日期"].ToString() == a)
                      {%>
                    <input id="del<%=allInfo.Rows[i]["登记号"] %>" name="<%=allInfo.Rows[i]["登记号"] %>" type="button"
                        value="删 除" onclick="delCode(this.getAttribute('name'));" />
                    <% } %>
                </td>
            </tr>
            <% } %>
            <% } %>
        </tbody>
    </table>
</div>
<div id="pageLink" style="padding-left: 15px; padding-right: 15px;">
    <%var pageInfo = ViewData["pageInfo"] as PagingInfo; %>
    <%if (pageInfo != null)
      {  %>
    <%=Ajax.PageLinks(pageInfo, index => Url.Action("ListTable", new
                {
                    page = index,
                }), new AjaxOptions { UpdateTargetId = "list_mytable" })%>
    <%} %>
</div>
